Adding a Parameter to a Report
In this tutorial, we will review how to create a parameter for a report.
To add a parameter to filter your report based on a database value, follow the steps below.
- First, create a report and bind it to a data source.
-
In the Field List window, right-click over the Parameters section and in the invoked menu, click Add Parameter. The Add New Parameter screen appears.
- Name: Enter the name for the parameter in this field. When you are setting a database value for the parameter (String type or Date/Time type), the Parameter Name must match the database table name from the report view. This is found when the Field List tab in the Property Grid is selected and the Report View is selected and expanded. The screen example below show the database field names for the vRptIssues report view from IntelliTrack. If you want to create a data range (From/To), you must prepend the Parameter Name with a From/To.
Important: If the parameter name does not match a field name from the report view, the report will not be able to find the data when running the report in IntelliTrack.
- Description: Enter the description for this parameter in this field. This is the parameter field description that will appear in your report in IntelliTrack.
- Type: for a data value, click the drop-down arrow and select String; for a date/time value, click the drop-down arrow and select Date/Time.
- Click OK to close the Add New Parameter screen. The parameter will appear in the Parameters list for this report.
- After the parameter is added to the list of parameters, it may be edited. To invoke the Parameter Collection Editor, right-click on the top-level parameter or any parameter in the list and click the Edit Parameters option.
Site Properties Portion of the Screen
Parameter Behavior: the Visible setting should remain set to Yes so that the parameter field appears in your report.
Parameter Data: includes the parameter description that will appear for the parameter field in your report and the parameter data type.
- Parameter Description: This is the parameter field description that will appear in your report. Supply a user friendly Description for the parameter, such as Site (for Site), "From Transaction Date" for FromTransactionDate, and To Transaction Date for ToTransactionDate.
- Data Type: The parameter may be a date-time data type, or a string type.
- Date-Time : If this is a date-time parameter, set the data type for the parameter to DateTime (or Date). For Dates, a Calendar will be displayed in the parameter field where the user can select a Date.
- String : If the parameter is a database value, set the Data Type to String, then the report designer will supply a text box in the report where the user can select the value.
Parameter Design: includes the parameter name that the report designer will reference when applying the parameter to your report.
- Name: Use the name of the field in the Report View for the Name of the Parameter. This will tell the Report Designer to compare that field with the value entered on the report view and display only those records that match that value for the field/Parameter.
- Prepend the Parameter Name: You can prepend a "From" or a "To" in the beginning of the Name of the Parameter. This will tell the report designer to do a greater than or less than comparison, respectively, when retrieving the records from the database for the report.
- For example, let's say there are three parameters: Site, FromTransactionDate, and ToTransactionDate. If Site = SiteOne, FromTransactionDate=10/03/2011 and ToTransactionDate = 11/14/2011, then the report designer will retrieve all records where the Site = SiteOne and the TransactionDate>=10/03/2011 and TransactionDate<=11/14/2011.
Members Portion of the Screen
You may order the parameters by selecting a parameter from the list and moving it up or down with the respective arrow, which is found to the right. The order of the parameters as displayed when viewing the report in IntelliTrack.